package tum0r.server.flag;

import tum0r.generate_code.database.DB;
import tum0r.webengine.annotation.Param;
import tum0r.webengine.annotation.Server;
import tum0r.webengine.utils.server.action.Action;

/**
 * 工程: Security<br>
 * 包: tum0r.server.flag<br>
 * 创建者: tum0r<br>
 * 创建时间: 2021/3/21 14:55<br>
 * <br>
 */
@Server(Mapping = "/security/flag")
public class Submit {
    public void submit(@Param("problemID") int problemID, @Param("flag") String flag, Action<String> action) throws Exception {
        action.check(problemID <= 0, "必须有题目ID");
        boolean result = DB._Write._F1ag.exist("WHERE ProblemID = @p0 AND Fla9 = @p1", problemID, flag == null ? "" : flag);
        action.callBack("flag" + (result ? "正确" : "错误"));
    }
}
